<template>
  <div class="mine is-wider">
    <the-head no-shadow></the-head>
    <mine-toolbar @create="folder = true"></mine-toolbar>
    <mine-create></mine-create>

    <div v-if="folder" class="bg">
      <div class="folder">
      <div class="folder-head">创建文件夹
        <div @click="folder = false" class="cross-pic"></div>
      </div>
      <div class="input-box">
        <input autofocus v-model="text" class="name-input" type="text" placeholder="请输入名称" required>
        <div class="hint">文件夹名称不能为空</div>
      </div>
      <div class="two-buttons">
        <button @click="folder = false" class="cancel-btn">取消</button>
        <button @click="folder = false" class="correct-btn">确定</button>
      </div>
      </div>
    </div>
  </div>
</template>

<script>
import TheHead from '../components/TheHead.vue';
import MineToolbar from '../components/mine/MineToolbar.vue';
import MineCreate from '../components/mine/MineCreate.vue';

export default {
  components: {
    TheHead,
    MineToolbar,
    MineCreate,
  },

  data() {
    return {
      folder: false,
      text: '新建文件夹',
    };
  },
};
</script>

<style lang="scss" scoped>
.mine {
  padding-top: 122px;
  background-color: #f4f6f9;
}

.bg{
  background-color:rgba(0, 0, 0, 0.55);
  width: 100vw;
  height: 100vh;
  position: fixed;
  right: 0;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 9999;
  animation: bg 0.2s ease 0.05s both;
}

.folder{
  width: 350px;
  height: 250px;
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  margin: auto;
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0px 10px 20px 0px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  line-height: 1.15;
}

.folder-head{
  font-size: 20px;
  margin: 30px 30px 0 30px;
  height: 50px;
}

.cross-pic{
  background-image: url('../assets/tankuang.svg');
  height: 20px;
  width: 20px;
  float: right;
  cursor: pointer;
}

.name-input{
  width: 100%;
  box-sizing: border-box;
  height: 40px;
  padding-left: 13px;
  padding-right: 13px;
  border: 1px solid #e1e7f2;
  border-radius: 4px;
  color: #333;
  margin-top: 10px;
  font-size: 14px;
  padding-top: 3px;
  outline: 0;
}

.name-input:invalid {
  border-color: #ef5350;
}

.name-input:focus {
  border-color: #008fff;
}

.name-input:invalid + .hint {
  height: 18px;
  background-color: #ef5350;
  line-height: 19px;
}

.hint{
  background-color: #ef5350;
  color: #ffeae6;
  // padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  width: 128px;
  overflow: hidden;
  box-sizing: border-box;
  text-align: center;
  margin-top: 4.5px;
  height: 0;
  position: absolute;
  transition: .2s;

}

.name-input::placeholder {
  color: #bfc8d2;
}

.input-box{
  padding: 0 30px;
  border-bottom: 1px solid #e1e7f2;
  padding-bottom: 48px;
  position: relative;
}

.two-buttons{
  height: 72px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-right: 30px;
}

.cancel-btn{
  height: 36px;
  box-sizing: border-box;
  text-align: center;
  min-width: 95px;
  max-width: 120px;
  border-radius: 4px;
  border: 1px solid #e1e7f2;
  font-size: 14px;
  background-color: #ffffff;
  cursor: pointer;
}

.cancel-btn:hover {
  background-color: #fafafa;
}

.correct-btn{
  height: 36px;
  box-sizing: border-box;
  text-align: center;
  min-width: 95px;
  max-width: 120px;
  border-radius: 4px;
  background-color: #008fff;
  border-color: #008fff;
  color: #fff;
  outline: 0;
  border: 0;
  margin-left: 10px;
  font-size: 14px;
  cursor: pointer;
}

.correct-btn:hover{
  background-color: #2196f3;
}

@keyframes bg {
  0% {
    opacity: 0;
  };
  100% {
    opacity: 1;
  }
};
</style>
